package org.zoffy.commons;

/**
 * 快捷返回响应结果的工具类
 */
public class ResultUtils {
    public static BaseResponse error(StatusCode statusCode,String message){
        return new BaseResponse<>(statusCode.getCode(),null, message);
    }
    public static BaseResponse error(int code,String message){
        return new BaseResponse<>(code,null, message);
    }
    public static BaseResponse error(StatusCode statusCode){
        return new BaseResponse<>(statusCode.getCode(),null, statusCode.getMsg());
    }
    public static <T> BaseResponse<T> success(T data){
        return new BaseResponse<>(StatusCode.SUCCESS.getCode(),StatusCode.SUCCESS.getMsg(), data);
    }
    public static BaseResponse success(){
        return ResultUtils.success(null);
    }
}
